/*
 * registryTest.cc
 *
 *  Created on: Sep 19, 2012
 *      Author: shaohong
 */

#include <iostream>
#include "registry.hh"

using namespace std;

int main() {

	map<std::string, std::vector<Entry>> oodi;

	cout << "adding one Entry" << endl;
	string studentId = "280558";
	Entry entry;
	entry.grade = 5;
	entry.course.courseId = "AS-03301";
	entry.course.courseName = "C++ Programming";
	entry.course.credits = 5;

	addEntry(oodi, studentId, entry);

	printTranscript(oodi, studentId);

	cout << "===" <<"add another entry" << endl;
	entry.grade = 4;
	entry.course.courseId = "S38-0000";
	entry.course.courseName = "Network Programming";
	entry.course.credits = 5;

	addEntry(oodi, studentId, entry);

	cout << "===" << "adding a failed entry" << endl;
	entry.grade = 0;
	entry.course.courseId = "FFFF";
	entry.course.courseName = "Network Programming";
	entry.course.credits = 5;
	addEntry(oodi, studentId, entry);

	printTranscript(oodi, studentId);


	cout << "===" << "Now, overriding the failed entry" << endl;
	entry.grade = 5;
	entry.course.courseId = "FFFF";
	entry.course.courseName = "Network Programming";
	entry.course.credits = 5;
	addEntry(oodi, studentId, entry);
	printTranscript(oodi, studentId);

	cout << "===" << "Now, see if we can override 5 with 3" << endl;
	entry.grade = 3;
	entry.course.courseId = "FFFF";
	entry.course.courseName = "Network Programming";
	entry.course.credits = 5;
	addEntry(oodi, studentId, entry);
	printTranscript(oodi, studentId);


	vector<Entry> failedOnes = getFailed(oodi);
	for(int i=0; i<failedOnes.size(); i++){
		cout << failedOnes[i].course.courseId << endl;
	}

	cout << "my credits are: " << calculateTotalCredits(oodi, studentId) << endl;

	cout << "my GPA is " << calculateAverage(oodi, studentId) << endl;
}

